package cn.dakaqi.entities;

import cn.dakaqi.utils.Identities;
import lombok.Data;
import lombok.ToString;
import org.apache.commons.lang3.RandomStringUtils;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * Copyright: Copyright (c)2016
 * Company: 志愿者打卡器(www.dakaqi.cn)
 * 类名称: Passport <br>
 * 类描述: <br>
 *
 * @author: ChunYang.Zhang
 * @since: 2016/10/19 16:41
 * @version: 1.0.0
 */
@Entity
@Table(name = "U_USER_PASSPORT_APPLY_ORDER")
@Data
@ToString
public class PassportApplyOrder extends IdEntity
{

    public static final int STAUTS_ABOLISH = -10;//已作废
    public static final int STAUTS_WAITE = 10;//待制证
    public static final int STAUTS_CHECK = 11;//已制证待复核
    public static final int STAUTS_SEND_WAITE = 20;//待发证
    public static final int STAUTS_SEND_OK = 30;//已发证
    public static final int STAUTS_ACTIVATED = 40;//已激活
    public static final int STAUTS_WAITE_LOGOUT = 50;//待注销
    public static final int STAUTS_LOGOUT = 60;//已注销
    public static final int STAUTS_CLOSEED = 70;//已关闭

    public static final int ORDER_STAUTS_CLOSE = -10;//关闭
    public static final int ORDER_STAUTS_NORMAL = 10;//正常
    public static final int ORDER_STAUTS_LOCKED = 20;//被锁定
    public static final int ORDER_STAUTS_FINSHED = 30;//完成

    public static final int BACK_STATUS_PRINT = 10;//制证退回
    public static final int BACK_STATUS_CHECK = 20;//复核退回
    public static final int BACK_STATUS_SEND = 30;//发证退回
    public static final int BACK_STATUS_LOGOUT = 40;//发证退回

    public static final int FROM_ONLINE = 1;//在线
    public static final int FROM_OFFLINE = 2;//现场

    private String num;
    private String name;//姓名
    private String sex;//性别
    private String cardType;//证件类型
    private String cardNO;//证件号
    private String mobile;//手机号
    private long bassAddressId;//基地编号
    private String note;//预约留言
    private String appointmenDate;//预约时间
    private String appointmentTime;//预约时间
    private String head;//照片
    private Date createTime;//申请时间

    private String birthday;//出生生日
    private int applyType;//申请类型 1 首次 2 换发 3 补发
    private String applyCase;//在换发、补发的情况下，需要选择原因
    private String contactName;//联系人姓名
    private String contactPhone;//联系人电话
    private String contactAddress;//联系人地址

    //监护人
    private String guardianName;//监护人姓名
    private String guardianSex;//监护人性别
    private String guardianRelation;//监护人关系
    private String guardianPhone;//监护人电话
    private String guardianCardType;//监护人证件类型
    private String guardianCardNo;//监护人证件号
    private String guardianUnit;//监护单位名称
    private String guardianUnitCode;//监护单位编号

    private int status;//发放状态
    private String passportNO;//公益护照编号
    private String signAddress;//发证地址
    private String signUnti;//发证单位
    private String signDate;//发证日期
    private long signUser;//发证人
    private String validityDate;//证件有效期
    private String demo;//备注
    private int orderStatus;//订单状态
    private int backStatus;//退回状态
    private int applyForm;// 10 在线 20 现场
    private long printUser;//打印者
    private String printTime;//打印时间
    private long checkUser;//复核者
    private String checkTime;//复核时间
    private String oldNum;//旧的订单号


    public static String createNum()
    {
        String tempNum = Identities.randomBase62(20).toUpperCase()+"ABCDEFGHJKLMNPRSTUVWXYZ"+System.currentTimeMillis();
        tempNum = tempNum.replace("O","");
        tempNum = tempNum.replace("I","");
        return (RandomStringUtils.random(6, tempNum));
    }
    public static String portNO(String cardNO)
    {
        String tempNum = "23456789"+Identities.randomLong()+System.currentTimeMillis();
        //return  cardNO.substring(0,6) + "001"+RandomStringUtils.random(9, tempNum);
        return  "310000001"+RandomStringUtils.random(9, tempNum);
    }
    public static void main(String[] args)
    {
        for(int i=0;i<=10;i++)
        System.out.println(portNO(null));
    }

}
